import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-product',
  templateUrl: './product.component.html',
  styleUrls: ['./product.component.css']
})
export class ProductComponent implements OnInit {

  private products: Array<Product>;
  private imgsrc: string;

  constructor() { }

  ngOnInit() {
    this.imgsrc = 'http://placehold.it/260x150';
    this.products = [
      new Product(1, '第1个商品', 1.66, 3.5, 'product', ['电子商品']),
      new Product(2, '第2个商品', 1.66, 3.5, 'product', ['电子商品']),
      new Product(3, '第3个商品', 1.66, 3.5, 'product', ['电子商品']),
      new Product(4, '第4个商品', 1.66, 3.5, 'product', ['电子商品']),
      new Product(5, '第5个商品', 1.66, 3.5, 'product', ['电子商品']),
      new Product(6, '第6个商品', 1.66, 3.5, 'product', ['电子商品']),
      new Product(7, '第7个商品', 1.66, 3.5, 'product', ['电子商品'])
    ]
  }

}

export class Product  {
  constructor(
    public id: number,
    public title: string,
    public price: number,
    public rating: number,
    public desc: string,
    public categories: Array<string>
    ) { }
}

export class Hero {
  constructor(
    public id: number,
    public name: string) { }
}

